use std::io;

fn main() {
    let a = Rectangle{
        width : 20,
        light : 60,
    };
    println!("a的面积为{}",a.area());
    println!("a的体积为{}",a.tiji(20));
    let b = Rectangle::new(20,60);
    let c = Rectangle::sqr(30);
    println!("{:#?}",b);
    println!("{:#?}",c);


}

#[derive(Debug)]
struct Rectangle{
    width : u32,
    light : u32,
}

impl Rectangle {
    fn area(&self) -> u32 {
        self.width * self.light
    }
    fn new(width:u32,light:u32) -> Rectangle {
        Rectangle{
            width,
            light,
        }
    }
    fn sqr(size:u32) -> Rectangle {
        Rectangle{
            width : size,
            light : size,
        }
    }
    fn tiji(&self,height:u32) -> u32 {
        self.area() * height
    }
}